package com.dodayum.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dodayum.entity.DemoJoinEntity;
import com.dodayum.mapper.DemoJoinMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author BaiYu
 * </br>@Date 2025/1/6 16:42
 * @version 1.0
 * 备注：
 */

@Service
public class DemoJoinService {

    @Resource
    DemoJoinMapper demoJoinMapper;

    public void insert(DemoJoinEntity demoJoinEntity) {}

    public void deleteById(String id) {}

    public void updateById(DemoJoinEntity demoJoinEntity) {}

    public List<DemoJoinEntity> query(DemoJoinEntity demoJoinEntity) {
        LambdaQueryWrapper<DemoJoinEntity> demoJoinEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
        demoJoinEntityLambdaQueryWrapper
                .eq(StringUtils.isNotBlank(demoJoinEntity.getId()),DemoJoinEntity::getId, demoJoinEntity.getId())
                .eq(StringUtils.isNotBlank(demoJoinEntity.getName()),DemoJoinEntity::getName, demoJoinEntity.getName());
        return demoJoinMapper.selectList(demoJoinEntityLambdaQueryWrapper);
    }

}
